#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int min;
	min=c*60+d-a*60-b;
	int e,f;
	e=min/60;
	f=min%60;
	cout<<e<<' '<<f;
	return 0;
}
